﻿<phone:PhoneApplicationPage
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
	xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
	xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing" 
	x:Class="WP7.Calculator.MainPage"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"     
	FontFamily="{StaticResource PhoneFontFamilyNormal}"
	FontSize="{StaticResource PhoneFontSizeNormal}"
	Foreground="{StaticResource PhoneForegroundBrush}"
	SupportedOrientations="PortraitOrLandscape"  Orientation="Portrait"
	shell:SystemTray.IsVisible="True">


    <phone:PhoneApplicationPage.Resources>
        <ResourceDictionary Source="Resources/Styles.xaml"></ResourceDictionary>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">


        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.9*"/>
                    <ColumnDefinition Width="0.1*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <TextBox x:Name="CalculatorTextBox" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CalculatorExpression, Mode=TwoWay}"/>
                <TextBlock x:Name="CalculatorResult" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding CalculatorResult, Mode=TwoWay}" HorizontalAlignment="Right"/>

            </Grid>
            <controls:Panorama Grid.Row="2" Grid.ColumnSpan="2">
                <controls:PanoramaItem>

                    <Grid>

                        <Grid Name="verGridPage1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <Button Content="1" Grid.Row="3" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="1"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="2" Grid.Row="3" Grid.Column="1">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="2" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Content="3" Grid.Row="3" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="3" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="4" Grid.Row="2" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="4" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="5" Grid.Row="2" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="5" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="6" Grid.Row="2" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="6" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="7" Grid.Row="1" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="7" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="8" Grid.Row="1" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="8" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="9" Grid.Row="1" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="9" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="." Grid.Row="4" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="." />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="0" Grid.Row="4" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="0" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="=" Grid.Row="4" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ExecuteExpressionCommand, Mode=OneWay}"  />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="/" Grid.Row="1" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="/" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="*" Grid.Row="2" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="*" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="-" Grid.Row="3" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="-" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="+" Grid.Row="4" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="+" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="(" Grid.Row="0" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content=")" Grid.Row="0" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter=")" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="C" Grid.Row="0" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ClearCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Grid.Row="0" Grid.Column="3">

                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding RemoveLastCharCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                                <es:BlockArrow Fill="{StaticResource PhoneForegroundBrush}" Height="30" Orientation="Left" UseLayoutRounding="False" Width="40"/>

                            </Button>

                        </Grid>




                        <Grid Name="horGridPage1" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <Button Content="1" Grid.Row="3" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="1"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="2" Grid.Row="3" Grid.Column="1">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="2" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Content="3" Grid.Row="3" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="3" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="4" Grid.Row="2" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="4" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="5" Grid.Row="2" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="5" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="6" Grid.Row="2" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="6" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="7" Grid.Row="1" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="7" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="8" Grid.Row="1" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="8" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="9" Grid.Row="1" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="9" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="." Grid.Row="0" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="." />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="0" Grid.Row="3" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="0" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="=" Grid.Row="3" Grid.Column="4" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ExecuteExpressionCommand, Mode=OneWay}"  />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="/" Grid.Row="2" Grid.Column="4" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="/" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="*" Grid.Row="1" Grid.Column="4" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="*" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="-" Grid.Row="2" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="-" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="+" Grid.Row="1" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="+" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="(" Grid.Row="0" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content=")" Grid.Row="0" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter=")" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="C" Grid.Row="0" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ClearCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Grid.Row="0" Grid.Column="4">

                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding RemoveLastCharCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                                <es:BlockArrow Fill="{StaticResource PhoneForegroundBrush}" Height="30" Orientation="Left" UseLayoutRounding="False" Width="40"/>

                            </Button>

                        </Grid>
                    </Grid>
                </controls:PanoramaItem>



                <controls:PanoramaItem >

                    <Grid>

                        <Grid Name="verGridPage2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>

                            <Button Content="x^2" Grid.Row="3" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^2"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="x^3" Grid.Row="3" Grid.Column="1">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^3" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Content="sqrt"  Grid.Row="3" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^0.5" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="asin" Grid.Row="2" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="asin(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="acos" Grid.Row="2" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="acos(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="atan" Grid.Row="2" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="atan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="sin" Grid.Row="1" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="sin(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="cos" Grid.Row="1" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="cos(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="tan" Grid.Row="1" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="tan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="pi" Grid.Row="4" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="pi" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="e" Grid.Row="4" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="e" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="=" Grid.Row="4" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ExecuteExpressionCommand, Mode=OneWay}"  />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="ctan" Grid.Row="1" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="ctan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="actan" Grid.Row="2" Grid.Column="3" Padding="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="actan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="x^y" Grid.Row="3" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="abs" Grid.Row="4" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="abs(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="(" Grid.Row="0" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content=")" Grid.Row="0" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter=")" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="C" Grid.Row="0" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ClearCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Grid.Row="0" Grid.Column="3">

                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding RemoveLastCharCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                                <es:BlockArrow Fill="{StaticResource PhoneForegroundBrush}" Height="30" Orientation="Left" UseLayoutRounding="False" Width="40"/>

                            </Button>

                        </Grid>
                        <Grid Name="horGridPage2" Visibility="Collapsed">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                                
                            </Grid.RowDefinitions>

                            <Button Content="x^2" Grid.Row="1" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^2"/>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="x^3" Grid.Row="2" Grid.Column="2">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^3" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Content="sqrt"  Grid.Row="1" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^0.5" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="asin" Grid.Row="1" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="asin(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="acos" Grid.Row="1" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="acos(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="atan" Grid.Row="3" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="atan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="sin" Grid.Row="0" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="sin(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="cos" Grid.Row="0" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="cos(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="tan" Grid.Row="2" Grid.Column="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="tan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="pi" Grid.Row="2" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="pi" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="e" Grid.Row="3" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="e" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="=" Grid.Row="2" Grid.Column="4" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ExecuteExpressionCommand, Mode=OneWay}"  />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>

                            <Button Content="ctan" Grid.Row="2" Grid.Column="1" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="ctan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="actan" Grid.Row="3" Grid.Column="1" Padding="0" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="actan(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="x^y" Grid.Row="3" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="^" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content="abs" Grid.Row="3" Grid.Column="4" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="abs(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="(" Grid.Row="0" Grid.Column="2" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter="(" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                            <Button Content=")" Grid.Row="0" Grid.Column="3" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding AddToTextCommand, Mode=OneWay}" CommandParameter=")" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>



                            <Button Content="C" Grid.Row="1" Grid.Column="4" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding ClearCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>


                            <Button Grid.Row="0" Grid.Column="4">

                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <Command:EventToCommand Command="{Binding RemoveLastCharCommand, Mode=OneWay}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                                <es:BlockArrow Fill="{StaticResource PhoneForegroundBrush}" Height="30" Orientation="Left" UseLayoutRounding="False" Width="40"/>

                            </Button>

                        </Grid>
                    </Grid>
                </controls:PanoramaItem>
            </controls:Panorama>
        </Grid>

    </Grid>
</phone:PhoneApplicationPage>